//package p.ithorns.sample.otel;
//
//import io.opentelemetry.api.OpenTelemetry;
//import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
//import io.opentelemetry.context.propagation.ContextPropagators;
//import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter;
//import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter;
//import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
//import io.opentelemetry.sdk.OpenTelemetrySdk;
//import io.opentelemetry.sdk.logs.SdkLoggerProvider;
//import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor;
//import io.opentelemetry.sdk.metrics.SdkMeterProvider;
//import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
//import io.opentelemetry.sdk.resources.Resource;
//import io.opentelemetry.sdk.trace.SdkTracerProvider;
//import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//
///**
// * Config
// *
// * @author HtL
// * @date 2025/3/20 13:54
// * @since 1.0.0
// */
////@Configuration
//public class Config {
//
//    @Primary
//    @Bean
//    public OpenTelemetry initOpenTelemetry() {
//        Resource resource = Resource.getDefault().toBuilder()
//                .put("service.name", "test-otel").put("service.version", "0.1.0").build();
//
//        SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
//                .addSpanProcessor(BatchSpanProcessor.builder(OtlpGrpcSpanExporter.builder().build()).build())
//                .setResource(resource)
//                .build();
//
////        SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
////                .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build()).build())
////                .setResource(resource)
////                .build();
//
//        SdkLoggerProvider sdkLoggerProvider = SdkLoggerProvider.builder()
//                .addLogRecordProcessor(
//                        BatchLogRecordProcessor.builder(OtlpGrpcLogRecordExporter.builder().build()).build())
//                .setResource(resource)
//                .build();
//
//        return OpenTelemetrySdk.builder()
//                .setTracerProvider(sdkTracerProvider)
////                .setMeterProvider(sdkMeterProvider)
//                .setLoggerProvider(sdkLoggerProvider)
//                .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
//                .buildAndRegisterGlobal();
//    }
//
//}